﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CoolCode.UnitTest
{
    public static class Extensions
    {
        public static bool IsNotNull<T>(this IEnumerable<T> collection)
        {
            if (collection == null)
                return false;
            return collection.All(c => c != null);
        }

        public static bool IsNotEmpty<T>(this IEnumerable<T> collection)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");
            return collection.Count() > 0;
        }

        public static void Dump(this object value)
        {
            ObjectDumper.Write(value);
        }

        public static void Dump(this object value, TextWriter writer)
        {
            ObjectDumper.Write(value, 0, writer);
        }

        public static void Dump(this object value, int depth, TextWriter writer)
        {
            ObjectDumper.Write(value, depth, writer);
        }

        public static void DebugDump(this object value)
        {
            Dump(value, new DebugWriter());
        }

        public static void DebugDump(this object value, int depth)
        {
            Dump(value, depth, new DebugWriter());
        }

    }
}
